package mudfox.repository;

import mudfox.entity.User;
import org.springframework.data.repository.CrudRepository;

import java.util.List;
import java.util.Optional;

/** CrudRepository 接口继承于 Repository 接口，并新增了如下方法
 long count();
 boolean exists(Integer arg0);

 <S extends StudentPO> S save(S arg0);
 <S extends StudentPO> Iterable<S> save(Iterable<S> arg0);

 void delete(Integer arg0);
 void delete(Iterable<? extends StudentPO> arg0);
 void delete(StudentPO arg0);
 void deleteAll();

 StudentPO findOne(Integer arg0);
 Iterable<StudentPO> findAll();
 Iterable<StudentPO> findAll(Iterable<Integer> arg0);
 */

// https://docs.spring.io/spring-data/commons/docs/current/api/overview-summary.html
// https://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/CrudRepository.html

/*
    StartingWith
    EndingWith
    Containing
*/
public interface UserRepository extends CrudRepository<User, Integer> {
    // User findByName(String name);
    Iterable<User> findByNameContaining(String name);
    Optional<User> findById(Integer id);
}